package me.lovetcat.common.constant;

/**
 * @author acat on 2017-01-10 16:26
 */
public class Resp {

    public interface Result{
        String OK = "ok";
        String FAIL = "fail";
    }

    public enum Code{
        OK(200, "操作成功"),
        FAIL_404(404, "请求资源未找到"),
        FAIL_SYS_EXCEPTION(500, "出错了(ಥ _ ಥ)！"),
        FAIL_PARAM_TYPE(900, "请求参数类型有误"),
        FAIL_REQUEST_METHOD(901, "请求方式有误"),
        FAIL_PARAMS_VALID(902, "请求参数校验有误");

        private final int code;
        private final String msg;
        Code(int code, String msg){
            this.code = code;
            this.msg = msg;
        }

        public int value(){
            return this.code;
        }

        public String msg(){
            return this.msg;
        }

        @Override
        public String toString() {
            return this.msg;
        }
    }
}
